package com.wuf.mybatis.mapping;

import com.wuf.mybatis.session.Configuration;
import com.wuf.mybatis.type.JdbcType;

/**
 * @className: com.wuf.mybatis.mapping.ParameterMapping
 * @description: 参数映射 #{property,javaType=int,jdbcType=NUMERIC}
 * @author: wuf
 * @create: 2024-05-14 16:16
 */
public class ParameterMapping {
    private Configuration configuration;

    // property
    private String property;
    // javaType = int
    private Class<?> javaType = Object.class;
    // jdbcType=NUMERIC
    private JdbcType jdbcType;

    private ParameterMapping() {
    }



    public static class Builder {
        private ParameterMapping parameterMapping = new ParameterMapping();

        public Builder(Configuration configuration, String property, Class<?> javaType) {
            parameterMapping.configuration = configuration;
            parameterMapping.property = property;
            parameterMapping.javaType = javaType;
        }

        public Builder javaType(Class<?> javaType) {
            parameterMapping.javaType = javaType;
            return this;
        }

        public Builder jdbcType(JdbcType jdbcType) {
            parameterMapping.jdbcType = jdbcType;
            return this;
        }

        public ParameterMapping build() {
            return parameterMapping;
        }
    }
}
